module SinatraDemo
  module Helpers
    module AlbumHelper
      require 'base64'
      def create_data_uri(source_file, mime_type)
        file_contents = File.open(source_file) { |f| f.read }
        encoded_string = Base64.encode64(file_contents)
        puts "data:#{mime_type};base64,#{encoded_string}"
      end
      def test
        source_file = './public/photo.jpg'
        mime_type = 'image/jpg'
        file_contents = File.open(source_file) { |f| f.read }
        base64_image = Base64.encode64(base64_image)
        base64_image = "data:#{mime_type};base64,#{encoded_string}"
      end
    end
  end
end
